/*
 ============================================================================
 Name        : Standard Deviation.c
 Author      : Alfonso Jimenez and Santiago Gallo
 Version     :
 Copyright   : Your copyright notice
 Description : Std deviation project
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include "statFunctions.h"
#include "lse.h"
#include "generalNames.h"

int main(void)
{
	UINT32 i;
	SINT32 size1, size2;
	FLOAT64 mean1, mean2, stdDev1, stdDev2;
	LSE lse_data1 = lse_new();
	LSE lse_data2 = lse_new();

	lse_add(&lse_data1,160);
	lse_add(&lse_data1,591);
	lse_add(&lse_data1,114);
	lse_add(&lse_data1,229);
	lse_add(&lse_data1,230);
	lse_add(&lse_data1,270);
	lse_add(&lse_data1,128);
	lse_add(&lse_data1,1675);
	lse_add(&lse_data1,624);
	lse_add(&lse_data1,1503);
	size1 = lse_size(&lse_data1);
	printf("Lista 1:\n");
	for(i = 0; i < size1; i++)
		printf("%d\n", lse_get(&lse_data1, i));
	printf("\n");

	lse_add(&lse_data2,15);
	lse_add(&lse_data2,69);
	lse_add(&lse_data2,6);
	lse_add(&lse_data2,22);
	lse_add(&lse_data2,28);
	lse_add(&lse_data2,65);
	lse_add(&lse_data2,19);
	lse_add(&lse_data2,198);
	lse_add(&lse_data2,38);
	lse_add(&lse_data2,138);
	size1 = lse_size(&lse_data2);
	printf("Lista 2:\n");
	for(i = 0; i < size1; i++)
		printf("%d\n", lse_get(&lse_data2, i));
	printf("\n");

	mean1 = statFunctions_mean(&lse_data1);
	printf("Average 1: %.1f\n", mean1);
	mean2 = statFunctions_mean(&lse_data2);
	printf("Average 2: %.1f\n", mean2);
	stdDev1 = statFunctions_stdDev(&lse_data1, mean1);
	printf("Standard deviation 1: %f\n", stdDev1);
	stdDev2 = statFunctions_stdDev(&lse_data2, mean2);
	printf("Standard deviation 2: %f\n", stdDev2);
	printf("The End");
	return EXIT_SUCCESS;
}
